package com.aiyige.model.request;

import com.aiyige.base.api.ApiManager;

import java.util.LinkedList;
import java.util.List;

import okhttp3.ResponseBody;
import retrofit2.Call;

/**
 * Created by zhuyakun on 2017/10/31.
 */
public class UpdateUserAdsRequest {

    private List<Ads> ads;

    private UpdateUserAdsRequest(Builder builder) {
        setAds(builder.ads);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public void setAds(List<Ads> ads) {
        this.ads = ads;
    }

    public List<Ads> getAds() {
        return ads;
    }

    public static class Ads {
        private String url;
        private String title;
        private String link;
        private int order;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getLink() {
            return link;
        }

        public void setLink(String link) {
            this.link = link;
        }

        public int getOrder() {
            return order;
        }

        public void setOrder(int order) {
            this.order = order;
        }
    }


    public static final class Builder {
        private List<Ads> ads;

        private Builder() {
            ads = new LinkedList<>();
        }

        public Builder ads(List<Ads> ads) {
            this.ads = ads;
            return this;
        }

        public Call<ResponseBody> build() {
            return ApiManager.getService().updateUserAds(new UpdateUserAdsRequest(this));
        }
    }
}